//
//  RegisterAfterChooseController.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/10/17.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "RegisterAfterChooseController.h"

@interface RegisterAfterChooseController ()

@end

@implementation RegisterAfterChooseController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createPeopleCountChooseView];
    [self createNavagationBackBtn];
    // Do any additional setup after loading the view.
}

-(void)createPeopleCountChooseView{
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"请选择自己的身份加入进来吧";
    titleLabel.font = [UIFont systemFontOfSize:20.f];
    [self.view addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(self.view.mas_top).offset(scaleTopAndBottom(45));
        make.left.equalTo(self.view);
        make.height.mas_equalTo(scaleTopAndBottom(30));
    }];
    UIImageView *firstImageView = [[UIImageView alloc] init];
    firstImageView.userInteractionEnabled = YES;
    firstImageView.tag = 100100;
    UITapGestureRecognizer *personaltap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(choosePersonalInput:)];
    [firstImageView addGestureRecognizer:personaltap];
    [self.view addSubview:firstImageView];
    [firstImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(15));
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(315), scaleLeftAndRight(250)));
    }];
    UIImageView *secondImageView = [[UIImageView alloc] init];
    secondImageView.userInteractionEnabled = YES;
    secondImageView.tag = 100200;
    UITapGestureRecognizer *institTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(choosePersonalInput:)];
    [secondImageView addGestureRecognizer:institTap];
    [self.view addSubview:secondImageView];
    [secondImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(firstImageView.mas_bottom).offset(scaleTopAndBottom(15));
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(290), scaleLeftAndRight(260)));
    }];
    firstImageView.image = [UIImage imageNamed:@"personID"];
    secondImageView.image = [UIImage imageNamed:@"JIGOUID"];
    UILabel *bottomLabel = [[UILabel alloc] init];
    bottomLabel.userInteractionEnabled = YES;
    bottomLabel.textAlignment = NSTextAlignmentRight;
    bottomLabel.text = @"悄悄走过";
    bottomLabel.tag = 100300;
    bottomLabel.textColor = COLOR_HEX(0xf4d11f);
    [self.view addSubview:bottomLabel];
    [bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.mas_right).offset(scaleLeftAndRight(-15));
        make.height.mas_equalTo(scaleTopAndBottom(20));
        make.bottom.equalTo(self.view.mas_bottom).offset(scaleTopAndBottom(-15));
        make.left.equalTo(self.view.mas_left);
    }];
    UITapGestureRecognizer *randomTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(choosePersonalInput:)];
    [bottomLabel addGestureRecognizer:randomTap];
}
-(void)choosePersonalInput:(UITapGestureRecognizer *)tap{
    UIView *view = tap.view;
    if (view.tag == 100100) {
        NSLog(@"你是要选择个人登录吗");
    }
    if (view.tag == 100200) {
        NSLog(@"这是机构的登录");
    }
    if (view.tag == 100300) {
        NSLog(@"这是要随便看看的");
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewWillAppear:(BOOL)animated{
    CGFloat offset = 0;
    [self.navigationController.navigationBar
     setBackgroundImage:[self imageWithColor:[UIColor colorWithRed:255/255.0 green:201/255.0 blue:31/255.0 alpha:(offset / 64)>0.99?0.99:(offset / 64)]] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar
     setShadowImage:[UIImage new]];
    self.tabBarController.tabBar.hidden = YES;
}
-(void)viewWillDisappear:(BOOL)animated{
    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:nil];
    self.tabBarController.tabBar.hidden = NO;
}
-(UIImage*) imageWithColor:(UIColor*) color
{
    CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
    
}
-(void)createNavagationBackBtn{
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
